<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


<script type="text/javascript">
			function edit(goodsId) {
				window.location.href = "${pageContext.request.contextPath}/admin/toEditGoods?goodsId="+goodsId;
			}
		</script>
</HEAD>
<body>
	<br>
	<table cellSpacing="1" cellPadding="0" width="100%" align="center"
		bgColor="#f5fafe" border="0">
		<TBODY>
			<tr>
				<td class="ta_01" align="center" bgColor="#afd1f3"><strong>商品列表</strong>
				</TD>
			</tr>
			<tr>
			</tr>
			<tr>
				<td class="ta_01" align="center" bgColor="#f5fafe">
					<table cellspacing="0" cellpadding="1" rules="all"
						bordercolor="gray" border="1" id="DataGrid1"
						style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
						<tr
							style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">

							<td align="center" width="10%">ID</td>
							<td align="center" width="10%">图书封面</td>
							<td align="center" width="10%">图书名称</td>
							<td align="center" width="10%">ishot</td>
							<td align="center" width="10%">商品数量</td>
							<td align="center" width="10%">售价</td>
							<td align="center" width="10%">已售出数量</td>
							<td align="center" width="10%">评分</td>
							<td width="10%" align="center">上架&下架</td>
							<td width="10%" align="center">编辑</td>

						</tr>
						<c:forEach items="${pageBean.list }" var="p" varStatus="status">
							<tr onmouseover="this.style.backgroundColor = 'white'"
								onmouseout="this.style.backgroundColor = '#F5FAFE';">
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%">${p.goodsId }</td>
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%"><img width="40" height="45"
									src="${ pageContext.request.contextPath }/${p.image}"></td>
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%">${p.bName }</td>
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%"><c:choose>
										<c:when test="${p.ishot==1 }">
														是
										</c:when>
										<c:otherwise>
														否
										</c:otherwise>
									</c:choose></td>
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%">${p.number }</td>
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%">${p.price }</td>
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%">${p.salNum }</td>
								<td style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="10%">${p.grade }</td>
								<td align="center"><c:if test="${p.gState==1}">
										<a
											href="${pageContext.request.contextPath }/admin/goodsOffline?goodsId=${p.goodsId}&page=${pageBean.page}">下架</a>
									</c:if> <c:if test="${p.gState==0}">
										<a
											href="${pageContext.request.contextPath }/admin/goodsOnline?goodsId=${p.goodsId}&page=${pageBean.page}">上架</a>
									</c:if></td>
								<td align="center"><c:if test="${p.gState==1}">
										请先下架商品
									</c:if> <c:if test="${p.gState==0}">
										<button type="button" onclick="edit(${p.goodsId})">编辑</button>
									</c:if></td>
							</tr>
						</c:forEach>
					</table>
				</td>
			</tr>
			<tr align="center">
				<td colspan="7">第 ${pageBean.page}/${pageBean.totlePage }页 <c:if
						test="${pageBean.page != 1 }">
						<a
							href="${pageContext.request.contextPath }/admin/findAllGoods?page=1">首页</a>|
			     	<a
							href="${pageContext.request.contextPath }/admin/findAllGoods?page=${pageBean.page-1}">上一页</a>
					</c:if> <c:forEach begin="1" end="${pageBean.totlePage }" var="i">
						<c:choose>
							<c:when test="${pageBean.page!=i}">
								<a
									href="${ pageContext.request.contextPath }/admin/findAllGoods?page=${i}">${i}</a>
							</c:when>
							<c:otherwise>
								<span class="currentPage">${i}</span>
							</c:otherwise>
						</c:choose>
					</c:forEach> <c:if test="${pageBean.page!= pageBean.totlePage }">
						<a
							href="${pageContext.request.contextPath }/admin/findAllGoods?page=${pageBean.page+1}">下一页</a> |
							<a
							href="${pageContext.request.contextPath }/admin/findAllGoods?page=${pageBean.totlePage }">尾页</a>
					</c:if>
				</td>
			</tr>
		</TBODY>
	</table>
</body>
</HTML>

